<?php

require_once 'common/conn.php';

$result = array();
if (isset($_GET['usercode'])) {
    $usercode = $_GET['usercode'];
}
if (isset($_GET['code'])) {
    $code = $_GET['code'];
}

if (isset($usercode) && isset($code)) {
    $db = new DBC();
    $sql = "SELECT downloadTimes FROM t_device_product WHERE usercode = '" . $usercode . "' AND flashcode = '" . $code . "' ORDER BY createTime DESC";
    $temp = $db->fetchData($sql);
    if ($temp != false && count($temp) > 0) {
        $result['downloadTimes'] = $temp[0]['downloadTimes'];               
    }
}
echo json_encode($result);
?>